/**
 * Created by alan on 2017/4/27.
 * 测站实测流量信息
 */
Ext.define('Admin.view.baseInfo.ddsBInt', {
    extend: 'Ext.container.Container',
    xtype: 'ddsBInt',
    //起别名
    alias: 'ddsBInt',
    requires: [
        'Admin.store.baseInfo.DdsBInt'
    ],
    controller: 'ddsBIntController',
    userCLs: 'big-100 small-100',
    margin: 7,
    bodyPadding: 7,
    layout: {
        type: 'vbox',
        align: 'stretch' //拉伸使其充满整个父容器
    },
    height: 200,
    autoLoad: true,
    items: [{
        xtype: "panel",
        height: 50,
        items: [{
            tbar: [
                //				{
                //					xtype: "textfield",
                //					maxWidth: 220,
                //					fieldLabel: "取水口名称",
                //					labelWidth: 80,
                //					reference: "intNm"
                //				},
                {
                    xtype: "combobox",
                    width: 400,
                    fieldLabel: "取水口名称",
                    reference: "intNm",
                    displayField: 'intNm',
                    queryMode: 'local',
                    valueField: 'intNm',
                    triggerAction: 'all',
                    anyMatch: true,
                    labelWidth: 80,
                    listeners: {
                        added: function(combo) {
                            var _that = this;
                            var store = Ext.create("Ext.data.Store", {
                                autoLoad: true,
                                proxy: {
                                    type: "ajax",
                                    url: config.URL + "szy/info/ddsBInt/list",
                                    extraParams: {
                                        river: config.RIVER
                                    },
                                    reader: {
                                        type: 'json',
                                        rootProperty: 'list',
                                        totalProperty: 'count'
                                    }
                                }
                            });
                            combo.setStore(store);
                        }
                    }
                },
                {
                    xtype: "button",
                    text: "查询",
                    iconCls: 'x-fa  fa-file-o',
                    handler: 'check',
                    margin: '0 10 0 10',
                    // style: 'background-color:#108ee9; border-radius:4px;-webkit-border-radius: 4px;',
                    style: 'border-radius:4px;-webkit-border-radius: 4px;'
                }
            ],
            margin: '0 0 10 0'
        }, ]
    }, {
        xtype: 'gridpanel',
        title: '地表取水口',
        flex: 1,
        scrollable: true,
        reference: 'ddsBIntGrid',
        columns: [{
                header: '地表水取水口名称',
                dataIndex: 'intNm',
                /** editor: 'textfield' ,*/
                align: 'center',
                width: '28%'
            },
            {
                header: '开始取水日期',
                dataIndex: 'fromIntDt',
                /** editor: 'textfield' ,*/
                align: 'center',
                width: '15%',
                // renderer:Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
                renderer: function(value) {
                    if (/\.0$/.test(value)) {
                        return value.substring(0, 19);
                    } else {
                        return value;
                    }
                }
            },
            {
                header: '取水方式',
                dataIndex: 'intTp',
                /** editor: 'textfield' ,*/
                align: 'center',
                width: '15%',
                renderer: function(value) {
                    return getValue('inttp', value);
                }
            },
            {
                header: '许可最大流量(m&sup3;/s)',
                dataIndex: 'maxPermQ',
                /** editor: 'textfield' ,*/
                align: 'center',
                width: '15%'
            },
            {
                header: '设计流量(m&sup3;/s)',
                dataIndex: 'desQ',
                /** editor: 'textfield' ,*/
                align: 'center',
                width: '14%'
            },
            {
                header: '许可总取水量(万m&sup3;)',
                dataIndex: 'permWw',
                /** editor: 'textfield' ,*/
                align: 'center',
                width: '12.8%'
            }

        ],
        store: {
            type: 'ddsBInt'
        },
        bbar: {
            xtype: 'pagingtoolbar',
            displayInfo: true,
            displayMsg: "显示从第{0}条数据到第{1}条数据，共{2}条数据",
            emptyMsg: "没有记录",
        },
        stripeRows: true,
        columnLines: true,
        plugins: {
            ptype: 'cellediting',
            clicksToEdit: 1
        }
    }]
})